package com.meizi.mall.product.web;

import com.meizi.mall.product.service.SkuInfoService;
import com.meizi.mall.product.vo.SkuItemVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.concurrent.ExecutionException;

/**
 * @author meizi
 * @email enjoymeizi@gmail.com
 * @date 2021/1/27 14:47
 */
@Controller
public class ItemController {
    @Autowired
    SkuInfoService skuInfoService;


    @GetMapping("{skuId}.html")
    public String item(@PathVariable(value = "skuId")Long skuId, Model model) throws ExecutionException, InterruptedException {
        SkuItemVo skuItemVo =  skuInfoService.item(skuId);
        model.addAttribute("skuItem",skuItemVo);
        return "item";
    }
}
